<!DOCTYPE html >
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<%@include file='/WEB-INF/pages/common/taglib.jsp'%>
<head>
<lb:shopDetail var="shopDetail" >
<title>LegendShop后台管理系统</title>
</lb:shopDetail>

<link rel="icon" href="${contextPath}/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<ls:templateResource item='/favicon.ico'/>"/>

<%@ include file="/WEB-INF/pages/common/jquery.jsp"%>

<style type="text/css">
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td {margin:0; padding:0; list-style:none; }
body, button, input, select, textarea { font:12px/1.5 "微软雅黑", tahoma, arial; }
h1, h2, h3, h4, h5, h6 { font-size:100%; }
ul, ol { list-style:none; }
fieldset, img { border:0; }
button, input, select, textarea { font-size:100%; }
table {border-collapse:collapse; border-spacing:0; }
a { text-decoration: none;color: inherit; color: #000;cursor: pointer; }
a:link,
a:visited,
a:hover { text-decoration: none;color: inherit; }
a:focus{outline:none;}
/*adminLogin------------------------------start*/
.adminLogin{height: 100%;width: 100%;background: #EEEEEE;position: relative;}
.adminLogin_cn{width: 550px;height: 420px;background: #fff; margin:0 auto; border-radius: 20px;-moz-box-shadow:-5px -5px 5px #EEEEE1;-webkit-box-shadow:-5px -5px 5px #EEEEE1;box-shadow:50px 50px 5px  #EEEEE1;text-align: center;}
.adminLogin_cn h3{margin-top: 20px;color: #979797;font-size: 20px;line-height: 50px;}
.adminLogin_input{border-bottom:1px solid #c3c3c3;border-top:1px solid #c3c3c3; width: 350px;margin: 10px auto;padding: 20px 0px;}
.adminLogin_input input{font-size: 14px;padding-left: 5px;width: 320px; margin:10px auto;border-radius:5px;border: 1px solid #c3c3c3;height: 30px;line-height:30px\9\0;*padding:8px 5px; *height:auto;}
.adminLogin_input a{display: inline-block;*display:inline;*zoom:1;width: 320px;padding: 8px 7px;background: #AAAAAA;color: #fff;font-size: 16px; margin:10px auto;border-radius:5px;}
/*adminLogin------------------------------end*/
#usernameErr{color:red;display:none;display:inline-block}
</style>

<script type="text/javascript">
	$(function(){
		//错误事件
		var error = "${param.error}";
			if(error == 1) {
				var errorMsg = '<fmt:message key="error.password.noright"/>';
				$("#usernameErr").html(errorMsg);
				$("#usernameErr").show();
			}
		
		//监听键盘enter
		$(document).keydown(function(event){
			if(event.keyCode==13) {
				submitForm();
			}
		});
	});
	
	function submitForm() {
		if(checkLogin()) {
			$("#loginForm").submit();
		} else {
			return false;
		}
	}
	function checkUsername() {
		var username = $("#username").val();
		//先判断用户名是否为空
		 if(username.length == 0){
			 $("#usernameErr").html("用户名不能为空！");
		 	 $("#usernameErr").show();
		 	 $("#usernameRig").hide();
			 return false;
		 }else{
		 	$("#usernameErr").hide();
			return true;
		 }
	}
	
	function checkPwd() {
		var pwd = $("#password").val();
		//先判断用户名是否为空
		 if(pwd.length == 0){
			 $("#usernameErr").html("密码不能为空，请输入密码！");
		 	 $("#usernameErr").show();
			 return false;
		 }else{
		 	$("#usernameErr").hide();
			return true;
		 }
	}
	
	function checkLogin() {
	
		if(!checkUsername()) {
			return false;
		}
		
		if(!checkPwd()) {
			return false;
		}
		
		return true;
	}
</script>


</head>
<body class="adminLogin">
     <div class="adminLogin_cn">
        <h3>LegendShop后台管理系统</h3>
        <form:form  id="loginForm" name="loginForm" method="post" action="${contextPath}/admin/j_spring_security_check">
	        <div class="adminLogin_input">
	            <input type="text" placeholder="用户名" name="j_username" id="username"/>
	            <input type="password" placeholder="密码" name="j_password" id="password" autocomplete="off"/>
	            <label id="usernameErr"></label>
	            <a href="javascript:submitForm();void(0);">登录</a>
	        </div>
        </form:form>
    </div>
</body>
</html>
